// 例子32

function Person(name, age){
    this.name = name;
    this.age = age;
}

Person.prototype.getName = function() {
    return this.name;
}

function Student(name, age, grade, _class) {
    Person.call(this, name, age); //构造函数继承
    this.grade = grade;
    this.class = _class;
}

Student.prototype = new Person(); // 原型继承
Student.prototype.constructor = Student; // 这句不能漏掉了
Student.prototype.getGradeAndClass = function() {
    return 'Grade ' + this.grade + ' Class ' + this.class;
}

var Tom = new Student('Tom', 10, 2, 5);
Tom.getName(); // "Tom"
Tom.getGradeAndClass(); // "Grade 2 Class 5"